from Devices.Chiot.BsDevs.ComDev.ComDev import ComDev

class PlugDevice(ComDev):
    class PlugFullStatus:
        def __init__(self):
            self.switchStatus = 0
            self.memSwitchStatus = 0
            self.backlightStatus = 0
            self.chargingProStatus = 0

            self.timers = []
            self.delay = PlugDevice.Delay()

            # homekit
            self.setupCode = ""
            self.setupPayload = ""
            self.hotPlug = 0x0

    class Delay(ComDev.Delay):
        def __init__(self, enable = False, end = "", services = []):
            super().__init__(enable=enable, end=end, services=services)
        
        def GetServiceString(self):
            pass
        
    class Timer(ComDev.Timer):
        def __init__(self, timerId = "", enable = False, start = "", end = "0", services = [], week = 0):
            super().__init__(timerId, enable, start, end, services, week)

        def GetServiceString(self):
            serviceString = ""
            for srv in self.services:
                if srv.serviceId == "switch":
                    serviceString += "开关"
                else: #srv.serviceId == "switch4"
                    serviceString += "未知服务"+srv.serviceId
                serviceString += ("打开" if srv.paraValue else "关闭")
            return serviceString[:-3]
